/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
  <file> uls.h </file>
  <brief>
    The main header file for ULS user.
    This file is part of ULS, Unified Lexical Scheme.
  </brief>
  <author>
    Stanley J. Hong <babel96@gmail.com>, August 2011.
  </author>
*/

#ifndef __ULS_INIT_H__
#define __ULS_INIT_H__

#include "uls_type.h"
#include "uls_lex.h"
#include "uls_conf.h"
#include "uls_print.h"
#include "uls_log.h"
#include "uls_util.h"
#include "uls_lf_sprintf.h"

#ifdef __cplusplus
extern "C" {
#endif

void 
#ifdef __GNUC__
__attribute__((constructor))
#endif
__initialize_uls(void);

void
#ifdef __GNUC__
__attribute__((destructor))
#endif
__finalize_uls(void);

int uls_fmtproc_coord(uls_lf_context_t* ctx, uls_lf_puts_t puts_proc);
int uls_fmtproc_tokname(uls_lf_context_t* ctx, uls_lf_puts_t puts_proc);

#ifdef __cplusplus
}
#endif

void initialize_uls(void);

#if defined(__GNUC__) || defined(__GNUG__)
// Just touch __initialize_uls and __finalize_uls
//   so that the program linked to this STATIC-version of uls 
//   may call <constructor,destructor> at the beginning.
static void *__SIGNATURE_OF_ULS1__ = (void *) __initialize_uls;
static void *__SIGNATURE_OF_ULS2__ = (void *) __finalize_uls;
static int __SIGNATURE_OF_ULS3__ = (&__SIGNATURE_OF_ULS1__ != NULL) || 
	(&__SIGNATURE_OF_ULS2__ != NULL) || (&__SIGNATURE_OF_ULS3__ != NULL);
#endif

#endif 
